package com.bjpowernode.services;

import com.bjpowernode.beans.Type;
import com.bjpowernode.mapper.TypeMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.UUID;


@Service
public class TypeServicesImp implements TypeServices {

    @Autowired
    TypeMapper typeMapper;


    @Override
    public ArrayList<Type> getAll() {
        return typeMapper.getAll();
    }

    @Override
    public Type get(String id) {
        return typeMapper.get(id);
    }

    @Override
    public boolean add(Type type) {
        //添加code
        UUID uuid = UUID.randomUUID();
        type.setCode(uuid.toString());
        return typeMapper.add(type)>0?true:false;
    }

    @Override
    public boolean edit(Type type) {
        return typeMapper.edit(type)>0?true:false;
    }

    @Override
    public boolean del(String[] ids) {
        return typeMapper.del(ids)>0?true:false;
    }
}
